package JackSu.简单;

import java.util.Arrays;

public class _01两数之和 {


    public static void main(String[] args) {
        int[] num = new int[]{3, 2, 4};
        int[] ints = twoSum(num, 6);
        System.out.println(Arrays.toString(Arrays.stream(ints).toArray()));


    }

    public static int[] twoSum(int[] nums, int target) {
        int rs[] = new int[2];
        for (int i = 0; i <= nums.length - 1; i++) {
            for (int j = 0; j <= nums.length-1 ; j++) {
                if (i!=j && nums[i] + nums[j] == target) {
                    rs[0] = i;
                    rs[1] = j;
                    return rs;

                }

            }
        }
        return rs;
    }

}

